
class TemplateThing < ContentWithFields

  attribute :name

  def recieve e
    Pattern::Property.properties(self.class, :attribute).each { |attr, definition|
      if data = e.params[(form_id attr)]
        self.send(attr.to_s+'=', data)
      end
    }
    super
  end
  
  def header_label
    add_button+
    self.class.to_s+
      " name: "+
      InputText.new(:name => (form_id :name), :value => name).to_s
  end

  def creator e
    super
  end

  def thingswecanadd
    [NamedDecorator]
  end

  def render item, e
    children.map { |ch|
      ch.child.render(item.send(ch.name)).to_s
    }.join
  end
end
